<!DOCTYPE html PUBLIC>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body  style="font-family: Arial; font-size: 13px; " >
<table border="0" cellpadding="0" style="border-collapse: collapse; margin:0 auto;" width="750" id="table4">
  <tr>
    <td><table border="0" cellpadding="0" style="border-collapse: collapse" width="100%" id="table5">
        <tr>
          <td align="center"><img border="0" src="../img/logosach.png" width="113"><br></td>
          <td align="center" valign="top" ><span style="font-size:21px; font-weight:bold ; ">CÔNG TY TNHH ĐẦU TƯ PHÁT TRIỂN SÁCH VB - MB</span><br>
            <span style="font-size: 17px ; word-spacing:1px; font-weight:bold; ">Trụ sở 129 Sông Nhuệ, Đông Ngạc, Từ Liên, Hà Nội</span><br>
            </b></font><span style="font-size:14px; font-weight:bold ;">Điện thoại: (04) 3977 1036 - 2243 0660- 62647134 Fax: (04) 62647134 - MST : 0309117564</span><br>
            <span style="font-size: 14px ; font-weight:bold; word-spacing:6px;  ">SỐ TÀI KHOẢN : 63679029 - Tại Ngân Hàng ACB  - CHI NHÁNH CẦU GIẤY</span>
            </p></td>
        </tr>
      </table>
      <br>
      <table border="0" cellpadding="0" style="border-collapse: collapse" width="100%" id="table6">
        <tr>
          <td><p align="center"><font size="5"><b>KIỂM TRA HÀNG TỒN KHO CHO ĐƠN HÀNH #ID <?PHP echo $_GET['id']; ?></b></font><br>
              <br>
            </p></td>
        </tr>
      </table>
      <table cellpadding="0" style="border-collapse: collapse" width="750" id="table4">
        <tr>
          <td><font size="1"><b>Họ tên khách hàng:</b></font></td>
          <td><font size="1"><?php echo $nd['Ho_va_ten'];?></font></td>
        </tr>
        <tr>
          <td><font size="1"><b>Địa chỉ:</b></font></td>
          <td><font size="1"><?php echo $nd['Dia_chi_chi_tiet'];?> - <?php echo $nd['Ten_quan_huyen'];?> - <?php echo $nd['Ten_tinh_thanh_pho'];?></font></td>
        </tr>
        <tr>
          <td><font size="1"><b>Điện thoại:</b></font></td>
          <td><font size="1"><?php echo $nd['Dien_thoai'];?></font></td>
        </tr>
        <tr>
          <td><font size="1"><b>Email:</b></font></td>
          <td><font size="1"><?php echo $nd['Email'];?></font></td>
        </tr>
        <tr>
          <td><font size="1"><b>Thời gian đặt hàng:</b></font></td>
          <td><font size="1"><?php echo $post['Thoi_gian'];?></font></td>
        </tr>
        <tr>
          <td><font size="1"><b>Thông tin thêm:</b></font></td>
          <td><font size="1"><?php echo $post['Thong_tin_them'];?></font></td>
        </tr>
      </table>
      <br>
      <span style="font-size: 13px"><strong>Thông tin chi tiết các mặt hàng như sau: </strong></span><br>
      <br>
      <table border="1" cellpadding="5" style="border-collapse: collapse" width="100%" id="table8">
        <tr>
          <td align="center" width="50"><b>STT</b></td>
          <td align="center" width="80"><b>Mã hàng</b></td>
          <td align="center"  width="200"><b>Tên hàng</b></td>
          <td align="center"><b>Đơn giá</b></td>
          <td align="center"><b>Số lượng đặt mua</b></td>
          <td align="center"><b>Số lượng còn</b></td>
          <td align="center"><b>Tình trạng</b></td>
        </tr>
        
        <?php 	$i=0;
				 $tongtien=0;
				 foreach ($ctx AS $tts) {
					$thanhtien= $tts['Gia_ban'] * $tts['So_luong'];
					$i+=1;
					$tongtien+=$thanhtien;
					$query = mysql_query("select * from sach where ID=".$tts['ID_Sach']);
					$row = mysql_fetch_array($query);
					$query1 = mysql_query("select * from Tinh_trang_sach where ID=".$row['ID_Tinh_trang_sach']);
					$row1 = mysql_fetch_array($query1);
					
					 ?>
        <tr>
          <td align="center" width="50"><?php echo $i ;?></td>
          <td align="center" width="80"><?php echo $tts['ID_Sach']; ?></td>
          <td align="center"  width="200"><?php echo $row['Ten_sach']; ?></td>
          <td align="center"><?php echo product_price($tts['Gia_ban']); ?></td>
          <td align="center"><?php echo $tts['So_luong']; ?></td>
          <?php if($row['So_luong']<$tts['So_luong']){?>
			   <td align="center" style="color:red;"><?php echo $row['So_luong']; ?></td>
			  <?php }else { ?>
          <td align="center"><?php echo $row['So_luong']; ?></td>
          <?php } ?>
          <td align="center"  width="200"><?php echo $row1['Ten_tinh_trang']; ?></td>
        </tr>
        <?php } ?>
      </table>
      
      
      <br>
      </td>
  </tr>
</table>
</body>
</html>